package com.wzdigit.wms.wms.config.schedule;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import java.util.concurrent.Executors;

@Configuration
public class ScheduleConfig implements SchedulingConfigurer {

    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {

        //配置定时任务线程池里有3个线程
        //TODO 貌似有最大线程数的风险，但是定时任务的数量固定
        taskRegistrar.setScheduler(Executors.newScheduledThreadPool(8));
    }
}